<!DOCTYPE html>
<html>

<head>
<title>添加代理</title>
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">

<%include("/common/include.html"){}%>
<style>
	.required{
		display:inline-block;
		width: 30%;
	}
	.requiredx{
		display:inline-block;
		width: 89%;
	}
	label{
		text-align:right;
		width:70px;
		display:inline-block;
	}
</style>
<style type="text/css">
</style>
</head>

<body>
	<div class="easyui-panel" style="width: 100%; padding: 30px 60px; border-width: 0px;">
		<div  style="margin:auto;width:770px">
			<form id="addProduct" method="post" class="form">
				<div style="margin-bottom: 20px">
					<label class="label-top">类型:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" value="${code.name! }" data-options="disabled:true">
					</div>
					<span style="color:red">*必填项</span>
					<input type="hidden" name="product.typeIds" value="${code.ids! }" />
	
					<label class="label-top" style="margin-left:30px">编号:</label>
					<div class="required">
						<input name="product.proBh" class="easyui-textbox theme-textbox-radius"  readonly="readonly" value="${typename !}" style="width: 100%;" >
					</div>
					<span style="color:red">*必填项</span>
				</div>
				<div style="margin-bottom: 20px">
					<label class="label-top">名称:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="product.name" data-options="prompt:'例：护肤乳'">
					</div>
					<span style="color:red">*必填项</span>
					<label class="label-top" style="margin-left:30px">规格:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="product.proSpecification" data-options="prompt:'例：120g一瓶'">
					</div>
					<span style="color:red">*必填项</span>
				</div>
				
			<!-- 	<div style="margin-bottom: 20px">
					<label class="label-top">单位:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="product.proUnits" data-options="prompt:'例：克'">
					</div>
					<span style="color:red">*必填项</span>
					<label class="label-top" style="margin-left:30px">容量:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="product.proCapacity" data-options="prompt:'例：120'">
					</div>
					<span style="color:red">*必填项</span>
				</div> -->
				
				<!-- <div style="margin-bottom: 20px">
					
					<label class="label-top" >产品用途:</label>
					<div class="required">
						<#code id="proUseIds" name="product.useIds" class="easyui-combobox theme-textbox-radius" code="code_cpyt" style="width: 100%;"/>
					</div>
					<span style="color:red">*必填项</span>
					<%if(code.name=='瘦身'){%>
					<label class="label-top" style="margin-left:30px">经验值:</label>
					<div class="required">
						<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="product.proExperience">
					</div>
					<span style="color:red">*必填项</span>
					<%}%>
				</div> -->
				
				
				<%if(code.name=='瘦身'){%>
				<div style="margin-bottom: 20px">
					<label class="label-top">部位经验值:</label>
					<a href="#" class="easyui-linkbutton button-blue button-sm" onclick="showPart();">
						<i class="fa fa-check"></i> 点击设置
					</a>
				</div>
				<%}%>
				
				<div id="partVal" style="display: none;">
				
				</div>
				<div id="win" class="easyui-window" title="设置服务部位经验值" style="width: 700px; height: 400px"
					data-options="iconCls:'icon-save',modal:true,closed:true,cls:'theme-panel-orange'">
					<div class="easyui-layout" data-options="fit:true">
						<div id="partText" data-options="region:'center'" style="width: 100%; height:100%; padding: 30px 60px;">
							<%for(var i = 0; i< servicePart.~size; i++){%>
								<div style="margin-bottom: 20px">
									<label class="label-top" style="width: 100%; display: block;text-align:left;">${servicePart[i].name! }经验值:</label>
									<div class="requiredx">
										<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="productExperienceList[${i!}].experience">
									</div>
									<span style="color:red">*必填项</span>
									<input type="hidden" name="productExperienceList[${i!}].partIds" value="${servicePart[i].ids! }">
								</div>
							<%}%>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
	
	<script type="text/javascript">
		function showPart() {
			$('#win').window('open');
		}
		//@ sourceURL=mmm.js
		var $form = $('#addProduct');

		var submitNow = function($dialog, $grid, $tree, $pjq) {
			$("#partVal").html($("#partText").html());
			var url = "${cxt!}/productSet/addProduct";
			$.post(url, sy.serializeObject($form), function(result) {
				if (result.code == '200') {
					$grid.datagrid('reload');
					$.slideMsg("添加成功！", $pjq);
					$dialog.dialog('destroy');
				} else {
					$.alert($pjq, result.msg);
				}
			}, 'json');
		};
		var submitForm = function($dialog, $grid, $tree, $pjq) {
			submitNow($dialog, $grid, $tree, $pjq);
			// 					$form.isValid(function(isValied){
			// 						if(isValied){
			// 							submitNow($dialog, $grid, $pjq);
			// 						}
			// 					});
		};

	</script>
</body>
</html>